import { EntitySchema } from '@mikro-orm/core';

export class LeOrderFreight {
  id!: string;
  orderSn!: string;
  type: boolean = true;
  code!: string;
  logisticsCompany!: string;
  freightSn!: string;
  createdTime!: string;
  updatedTime?: string;
  deletedTime?: string;
  isDeleted: boolean = false;
  previewImage?: string;
}

export const LeOrderFreightSchema = new EntitySchema({
  class: LeOrderFreight,
  properties: {
    id: { primary: true, type: 'string', columnType: 'bigint' },
    orderSn: { type: 'string', length: 50, index: '订单编号' },
    type: { type: 'boolean', default: true },
    code: { type: 'string', length: 20 },
    logisticsCompany: { type: 'string', length: 50 },
    freightSn: { type: 'string', length: 50, index: '物流编号' },
    createdTime: { type: 'string', columnType: 'bigint' },
    updatedTime: { type: 'string', columnType: 'bigint', nullable: true },
    deletedTime: { type: 'string', columnType: 'bigint', nullable: true },
    isDeleted: { type: 'boolean', default: false },
    previewImage: { type: 'string', length: 2048, nullable: true },
  },
});
